package task;

import org.springframework.cloud.contract.spec.Contract

Contract.make {
    request {
        method 'POST'
        url value(consumer(regex('api/tasks/duplication')), producer('api/tasks/duplication'))
        headers {
            contentType(applicationJsonUtf8())
        }
        body("""
            {
                "sourceTaskIds": [1,2],
                "topicId": 1
            }
        """)
        bodyMatchers {
            jsonPath('$.sourceTaskIds',byRegex(nonEmpty()))
            jsonPath('$.topicId',byRegex(number()))
        }
    }
    response {
        status 201
    }
}